<template>
    <div class="w750 white-bg">
        <!-- 问题详情 -->
        <div class="news-det">
            <template v-if="QuestionDetail">
                <div class="det-tit">{{ QuestionDetail.newsTitle }}</div>
                <div class="det-txt" v-html="QuestionDetail.newsContent">{{ QuestionDetail.newsContent }}</div>
                <div class="det-time">发表于 {{ QuestionDetail.newsDate | dateformat('YYYY-MM-DD HH:mm') }}</div>
            </template>
            <Noempty :pic="require('../../assets/images/record-empty.png')" :title="'对不起, 该文章找不到或已被删除!'" v-else />
        </div>
        <!-- /问题详情 -->
    </div>
</template>

<script>
import Noempty from 'components/Noempty/Noempty';
import { questionApi } from 'api/question';
export default {
    components: {
        Noempty
    },

    data() {
        return {
            QuestionDetail: null, //问题详情
            photoServer: this.$imgUrlHead //图片
        };
    },

    activated() {
        let that = this;

        let newsDetailId = this.$route.query.newsId;

        questionApi.questionDetail({ newsId: newsDetailId }).then(res => {
            if (res.status == 1) {
                this.QuestionDetail = res.result;
            } else {
                this.$toast({ duration: 1000, message: res.msg });
            }
        }),
            () => {
                this.$toast({ duration: 1000, message: '获取数据失败' });
            };
    },
    deactivated() {}
};
</script>

<style src="../../assets/css/news.css" scoped></style>
<style scoped>
.det-txt >>> img {
    max-width: 100%;
}
</style>
